let globalToken: string | null = null;

const setGlobalToken = (newToken: string) => {
  globalToken = newToken;
  localStorage.setItem('token', newToken);
};

const removeGlobalToken = () => {
  globalToken = null;
  localStorage.removeItem('token');
};

const getGlobalToken = () => globalToken || localStorage.getItem('token') || '';

export { setGlobalToken, removeGlobalToken, getGlobalToken };
